import static org.junit.Assert.*;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.Socket;
import java.net.SocketException;
import java.net.UnknownHostException;

import org.junit.Test;


public class ClientTestCase {

	@Test
	public void testSendCommand() throws IOException{
		Socket clientSocket = new Socket(InetAddress.getByName("127.0.0.1"), MainServer.SERVER_SOCKET_PORT);
		Socket serverSocket = MainServer.generateServerSocket();
		DataInputStream clientSocketIn = new DataInputStream(clientSocket.getInputStream());
		DataOutputStream clientSocketOut = new DataOutputStream(clientSocket.getOutputStream());
		DataInputStream serverSocketIn = new DataInputStream(serverSocket.getInputStream());
		DataOutputStream serverSocketOut = new DataOutputStream(serverSocket.getOutputStream());
		clientSocketOut.writeChar('S');
		char command = serverSocketIn.readChar();

		clientSocket.close();
		serverSocket.close();
		assertEquals(command, "S");
		
	}
	
}
